
#include "file_type.h"


using namespace std;


FileType::FileType(){
    this->_name = "No filetype";
    this->_hl_opts._numbers = false;
    this->_hl_opts._strings = false;
    this->_hl_opts._characters = false;
    this->_hl_opts._comments = false;

}


FileType::~FileType(){

}

string FileType::Name(){
    return this->_name;
}

HighlightingOptions FileType::HlOptions(){
    return this->_hl_opts;
}

FileType FileType::Create(string fileName){
    FileType ft;
    if (Util::EndsWith(fileName,".cc")){
        ft._name = "CPP";
        ft._hl_opts._numbers = true;
        ft._hl_opts._strings = true;
        ft._hl_opts._characters = true;
        ft._hl_opts._comments = true;
        ft._hl_opts._primary_keywords = {
            "as","break","const","continue","else","enum","extern","false","for","if",
            "in","while","switch","#include","private","public","return","this","static","struct",
            "base","class","true","type","unsafe","using","where","abstract","vector","do",
            "define","override","typeof","unsized","virtual","namespace","try","delete"
        };
        ft._hl_opts._secondary_keywords = {
            "bool","char","int","long","unsigned","float","double","size_t","void","string"
        };
    }else if (Util::EndsWith(fileName,".rs")){
        ft._name = "RUST";
        ft._hl_opts._numbers = true;
        ft._hl_opts._strings = true;
        ft._hl_opts._characters = true;
        ft._hl_opts._comments = true;
        ft._hl_opts._primary_keywords = {
            "as","break","const","continue","crate","else","enum","extern","false","fn",
            "for","if","impl","in","let","loop","match","mod","move","mut",
            "pub","ref","return","self","Self","static","struct","super","trait","true",
            "type","unsafe","use","where","while","dyn","abstract","become","box","do",
            "final","macro","override","priv","typeof","unsized","virtual","yield","async","await",
            "try"
        };
        ft._hl_opts._secondary_keywords = {
            "bool","char","i8","i16","i32","i64","isize","u8","u16","u32",
            "u64","usize","f32","f64"
        };
    }else if (Util::EndsWith(fileName,".txt")){
        ft._name = "PLAIN TEXT";
        ft._hl_opts._numbers = false;
        ft._hl_opts._strings = false;
        ft._hl_opts._characters = false;
        ft._hl_opts._comments = false;
    }
    return ft;
}





bool HighlightingOptions::Numbers(){
    return this->_numbers;
}


bool HighlightingOptions::Strings(){
    return this->_strings;
}


bool HighlightingOptions::Characters(){
    return this->_characters;
}

bool HighlightingOptions::Comments(){
    return this->_comments;
}

bool HighlightingOptions::MultilineComments(){
    return this->_multiline_comments;
}

std::vector<std::string> HighlightingOptions::PrimaryKeywords(){
    return this->_primary_keywords;
}

std::vector<std::string> HighlightingOptions::SecondaryKeywords(){
    return this->_secondary_keywords;
}

